home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / dll_gen / drvplus / chgvname.frm < prev    next >
Text File  |  1994-07-22  |  4KB  |  143 lines

  1. VERSION 2.00
  2. Begin Form ChgVname 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Change Volume Name"
  6.    ClientHeight    =   2400
  7.    ClientLeft      =   1095
  8.    ClientTop       =   1485
  9.    ClientWidth     =   3615
  10.    ControlBox      =   0   'False
  11.    Height          =   2805
  12.    Left            =   1035
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2400
  17.    ScaleWidth      =   3615
  18.    Top             =   1140
  19.    Width           =   3735
  20.    Begin TextBox Text1 
  21.       Height          =   285
  22.       Left            =   240
  23.       MaxLength       =   11
  24.       TabIndex        =   0
  25.       Text            =   "Text1"
  26.       Top             =   1200
  27.       Width           =   3135
  28.    End
  29.    Begin DriveListBox Drive1 
  30.       Height          =   315
  31.       Left            =   240
  32.       TabIndex        =   3
  33.       Top             =   240
  34.       Width           =   3135
  35.    End
  36.    Begin CommandButton CmdOkay 
  37.       BackColor       =   &H00C0C0C0&
  38.       Cancel          =   -1  'True
  39.       Caption         =   "O &K A Y"
  40.       Height          =   375
  41.       Left            =   1800
  42.       TabIndex        =   2
  43.       Top             =   1800
  44.       Width           =   1575
  45.    End
  46.    Begin CommandButton CmdChgName 
  47.       BackColor       =   &H00C0C0C0&
  48.       Caption         =   "Change &Name"
  49.       Default         =   -1  'True
  50.       Height          =   375
  51.       Left            =   240
  52.       TabIndex        =   1
  53.       Top             =   1800
  54.       Width           =   1575
  55.    End
  56. End
  57. Dim VolName As String
  58.  
  59. Sub CmdChgName_Click ()
  60.     Screen.MousePointer = 11
  61.     NewVolName$ = Text1.Text
  62.     If Len(NewVolName$) > 8 Then
  63.         x% = Len(NewVolName$)
  64.         TempName = Left$(NewVolName$, 8) + "." + Right$(NewVolName$, x% - 8)
  65.         NewVolName$ = TempName
  66.         End If
  67.     If NewVolName$ = "No Label" Then NewVolName$ = ""
  68.     NowDrive% = Asc(Left$(UCase$(Drive1.Drive), 1)) - 64
  69.     worked% = SetVolName(NowDrive%, NewVolName$)
  70.     Screen.MousePointer = 0
  71.     If worked% = False And NewVolName$ <> "" Then
  72.         MsgBox "Unable to rename volume!", 16, "Drive Error"
  73.         Exit Sub
  74.         End If
  75.     FormPassString = "NewVol"
  76.     Unload Me
  77. End Sub
  78.  
  79. Sub CmdOkay_Click ()
  80.     FormPassString = "Okay"
  81.     Unload Me
  82. End Sub
  83.  
  84. Sub Drive1_Change ()
  85.     Screen.MousePointer = 11
  86.     DriveLabel$ = UCase$(Drive1.Drive)
  87.     DriveNbr% = Asc(DriveLabel$) - 64
  88.     x& = GetDriveSize(DriveNbr%)
  89.     Screen.MousePointer = 0
  90.     If x& = 0 Then
  91.         MsgBox "Unavailable drive!", 16, "Drive Error " + DriveLabel$
  92.         drv% = GetDefaultDrive()
  93.         Drive1.Drive = UCase$(Chr$(drv% + 64))
  94.         End If
  95.     GetVolName
  96.     Text1.Text = VolName$
  97.     Text1.SetFocus
  98. End Sub
  99.  
  100. Sub Form_Load ()
  101.     FormCenterForm Me, DemoMain
  102.     GetVolName
  103.     Text1.Text = VolName$
  104.     Screen.MousePointer = 0
  105. End Sub
  106.  
  107. Sub Form_Paint ()
  108.     DoForm3D Me, sunken, 3, 0
  109.     DoForm3D Me, raised, 1, 3
  110. End Sub
  111.  
  112. Sub GetVolName ()
  113.     DriveLabel$ = Left$(UCase$(Drive1.Drive), 2)
  114.     FileSpec$ = DriveLabel$ + "\*.*"
  115.     FoundIt$ = Dir$(FileSpec$, 8)
  116.     If FoundIt$ = "" Then FoundIt$ = "No Label"
  117.     If Len(FoundIt$) > 8 Then
  118.         FoundIt$ = Strip(FoundIt$, ".")
  119.         End If
  120.     VolName$ = FoundIt$
  121. End Sub
  122.  
  123. Sub Text1_GotFocus ()
  124.     Text1.SelStart = 0
  125.     Text1.SelLength = Len(Text1.Text)
  126. End Sub
  127.  
  128. Sub Text1_KeyPress (KeyAscii As Integer)
  129.     Char = Chr(KeyAscii)
  130.     KeyAscii = Asc(UCase(Char))
  131.     If Char = Chr$(8) Then Exit Sub
  132.     If KeyAscii >= Asc("0") And KeyAscii <= Asc("9") Then Exit Sub
  133.     If KeyAscii = Asc(" ") Then Exit Sub
  134.     If KeyAscii = Asc("*") Then Exit Sub
  135.     If KeyAscii = Asc("$") Then Exit Sub
  136.     If KeyAscii = Asc("!") Then Exit Sub
  137.     If KeyAscii < Asc("A") Or KeyAscii > Asc("Z") Then
  138.         KeyAscii = 0
  139.         Exit Sub
  140.         End If
  141. End Sub
  142.  
  143.